{% extends "base.html" %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">编辑售后服务记录</h4>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <div class="mb-3">
                            <label class="form-label">订单号</label>
                            <input type="text" class="form-control" value="{{ service.order_id }}" readonly>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">客户名称</label>
                            <input type="text" class="form-control" name="customer_name" value="{{ service.customer_name }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">联系电话</label>
                            <input type="text" class="form-control" name="contact_phone" value="{{ service.contact_phone }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">服务类型</label>
                            <select class="form-select" name="service_type" required>
                                <option value="complaint" {% if service.service_type == 'complaint' %}selected{% endif %}>投诉</option>
                                <option value="return" {% if service.service_type == 'return' %}selected{% endif %}>退货</option>
                                <option value="repair" {% if service.service_type == 'repair' %}selected{% endif %}>维修</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">状态</label>
                            <select class="form-select" name="status" required>
                                <option value="pending" {% if service.status == 'pending' %}selected{% endif %}>待处理</option>
                                <option value="processing" {% if service.status == 'processing' %}selected{% endif %}>处理中</option>
                                <option value="completed" {% if service.status == 'completed' %}selected{% endif %}>已完成</option>
                                <option value="closed" {% if service.status == 'closed' %}selected{% endif %}>已关闭</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">优先级</label>
                            <select class="form-select" name="priority" required>
                                <option value="low" {% if service.priority == 'low' %}selected{% endif %}>低</option>
                                <option value="normal" {% if service.priority == 'normal' %}selected{% endif %}>普通</option>
                                <option value="high" {% if service.priority == 'high' %}selected{% endif %}>高</option>
                                <option value="urgent" {% if service.priority == 'urgent' %}selected{% endif %}>紧急</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">问题描述</label>
                            <textarea class="form-control" name="description" rows="4" required>{{ service.description }}</textarea>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">解决方案</label>
                            <textarea class="form-control" name="solution" rows="4">{{ service.solution }}</textarea>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">备注</label>
                            <textarea class="form-control" name="notes" rows="3">{{ service.notes }}</textarea>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">保存修改</button>
                            <a href="{{ url_for('service.service_list') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 